<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	template="/xhtml/templates/layout.xhtml">

	<ui:define name="title"> #{msgs.login_tabTitle} </ui:define>

	<ui:define name="entete">
		<h:form styleClass="container-vertically-centered">
			<p:toolbar id="enteteTolBar">
				<p:toolbarGroup id="enteteTolBarGroup" align="left">
					<h:outputText value="#{msgs.login_title}" />
				</p:toolbarGroup>
			</p:toolbar>
		</h:form>
	</ui:define>

	<ui:define name="language">
		<h:form styleClass="container-vertically-centered">
			<h:outputText value="#{msgs.language}" />
			<h:selectOneMenu id="languageChoice" value="#{locale.localeCode}" onchange="submit()" valueChangeListener="#{locale.countryLocaleCodeChanged}">
				<f:selectItems var="item" itemLabel="#{item.displayName}" value="#{locale.countries}" />
				<f:converter converterId="LocaleConverter" />
			</h:selectOneMenu>
		</h:form>
	</ui:define>
	  
		<ui:define name="login_identification">
		<h:form id="login" prependId="false" onsubmit="document.#{p:component('login')}.action='j_security_check';">
			<h:panelGrid id="loginGrid" columns="3">
				<h:outputText for="j_username" value="${msgs.username}" />
				<p:inputText id="j_username" required="true" label="Username">
					<f:validateLength minimum="4" />
					<f:validateRequired />
					<p:ajax event="blur" update="msgj_username" />
				</p:inputText>
				<h:message id="msgj_username" for="j_username" />

				<h:outputText for="j_password" value="${msgs.password}" />
				<p:password id="j_password" required="true">
					<f:validateLength minimum="4" />
					<f:validateRequired />
					<p:ajax event="blur" update="msgj_password" />
				</p:password>
				<h:message id="msgj_password" for="j_password" />

				<p:commandButton onclick="document.#{component.clientId}.action='j_security_check';" value="${msgs.login}" />

			</h:panelGrid>
		</h:form>
		<script> $('#j_password input').attr('name', 'j_password'); </script>
	</ui:define>

	<ui:define name="pieddepage">
		<h:form styleClass="container-vertically-centered">
			<p:toolbar id="pieddepageTolBar">
				<p:toolbarGroup id="pieddepageTolBarGroup" align="left">
					<h:outputText value="#{msgs.login_underTitle}" />
				</p:toolbarGroup>
			</p:toolbar>		
		</h:form>
	</ui:define>

</ui:composition>